**** Figure 6

clear all
set more off 
capture log close
 
* main path to data
global path "~/Dropbox/Paraguay/1_data/7_replication_dataverse"
capture cd "$path"	

*figures= analysis figures
global figures "$path/figures"

* Load and prepare data
use "$path/data/anr.dta", clear

xtset district_code periods


forval i = 1/9 {
    generate p`i' = (periods == `i')
}

// Generate the 'alt_p' variable and set it to 0
generate alt_p = 0


set more off
eststo clear


	reghdfe l_anr ///
    i.p1##c.lambda_z ///
    p2##c.lambda_z ///
    p3##c.lambda_z ///
    p4##c.lambda_z ///
    p5##c.lambda_z ///
    p6##c.lambda_z ///
    alt_p ///
    p8##c.lambda_z ///
    p9##c.lambda_z, absorb(periods district_code periods#depa) cluster(district_code) nocons

	
set scheme s1mono
coefplot, vertical ///
    omitted ///
    keep(*.p1#c.lambda_z *.p2#c.lambda_z *.p3#c.lambda_z *.p4#c.lambda_z *.p5#c.lambda_z ///
         *.p6#c.lambda_z alt_p *.p8#c.lambda_z *.p9#c.lambda_z) ///
    yline(0, lcolor(red)) ///
    xlabel(1 "1959-1963" 2 "1964-1968" 3 "1969-1973" ///
           4 "1974-1978" 5 "1979-1983" 6 "1984-1988" 7 "1989-1993" 8 "1994-1998" ///
           9 "1999-2003", alternate) ///
    xtitle("Five-year Period", size(3.7) margin(small)) ///
    ytitle("Effect relative to 1989-1993", size(3.7) margin(small)) ///
    ciopts(recast(rcap)) ///
    yscale(range(-0.13 0.26)) ///
    xline(7, lpattern(dash))	
	

		  
graph export "$figures/figure6.pdf", replace
